﻿@model ITS.Website.Models.ManageContentViewModel
@{
    ViewBag.Title = "Create new content - " + Model.ContentCategoryName;
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>@Model.ContentCategoryName</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm("ManageContent", "Content", null, FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true)

    @Html.HiddenFor(m => m.ContentCategoryID)
    <fieldset>
        <legend>Create new content</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.Keyword)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Keyword)
            @Html.ValidationMessageFor(model => model.Keyword)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.SubCategoryID)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.SubCategoryID, Model.SubCategories)
            @Html.ValidationMessageFor(model => model.SubCategoryID)
        </div>
        <p>
            <input type="submit" value="Find" />
        </p>
        <div>
            <table>
                @foreach (var item in Model.ContentItems)
                {
                    <tr>
                        <td>
                            @foreach (var name in item.Titles)
                            {
                                @Html.Label(name)<br />
                            }
                        </td>
                        <td>
                            @Html.Encode(String.Format("{0: dd-MM-yyyy}", item.CreatedDate))
                        </td>
                        <td>
                            @Html.ActionLink("Edit", "EditContentItem", "Content", new { ID = item.ContentID }, null)
                        </td>
                    </tr>
                }
            </table>
        </div>
    </fieldset>
}
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
